﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using GtsServer.DAL;
using GtsServer.Common;
using System.Data;

namespace GtsServer.Manage.Controller
{
    public class FeedBackController
    {
        FeedBackDAL dal = new FeedBackDAL();
        public List<FeedBack> GetList(string imsi, string userAccount, string start, string end, int pageIndex, int pageSize, out int count)
        {
            count = 0;

            string strWhere = "";
            if (!string.IsNullOrEmpty(imsi))
                strWhere += " and u.IMSI ='" + imsi + "'";
            if (!string.IsNullOrEmpty(userAccount))
                strWhere += " and u.UserAccount='" + userAccount + "'";
            if (!string.IsNullOrEmpty(start))
                strWhere += " and f.RequestTime>='" + start + "'";
            if (!string.IsNullOrEmpty(end))
                strWhere += " and f.RequestTime<='" + end + "'";

            DataSet ds = dal.GetList(strWhere,pageIndex, pageSize);
            count = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
            return IListDataSet.DataSetToIList<FeedBack>(ds, 0).ToList();
        }
    }
}
